<template>
  <div>
    <h1 id="h1" ref="title">这是一个h2</h1>
    <button @click="get">点击获取</button>

    <br />
    <MyProduct ref="de" />
    <button @click="getmy">点击获取组件</button>
  </div>
</template>

<script>
import MyProduct from "./components/MyProduct.vue";
export default {
  components: {
    MyProduct,
  },
  name: "DayWuApp",

  data() {
    return {};
  },

  mounted() {},

  methods: {
    get() {
      console.log(this.$refs.title);
      console.log(document.querySelector("#h1"));
    },
    getmy() {
      console.log(this.$refs.de);
      console.log(this.$refs.de.msg);
      this.$refs.de.demoFn();
    },
  },
};
</script>

<style scoped>
</style>